﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Tools;

namespace Punia
{
    [CommandAttribute(false)]
    public partial class drop_remote_services : BaseForm
    {
        public drop_remote_services()
            : base()
        {
        }

        public drop_remote_services(DbContext dbContext)
            : base(dbContext)
        {
            InitializeComponent();

            cbRemote.DataSource = Utility.remote_bindings(dbContext);
            cbRemote.DisplayMember = "Name";

            cbRemote.SelectedIndexChanged += new EventHandler(cbRemote_SelectedIndexChanged);
        }

        void cbRemote_SelectedIndexChanged(object sender, EventArgs e)
        {
            Write();
        }

        protected override void Write()
        {
            StringBuilder sb = new StringBuilder();

            if(cbRemote.SelectedIndex > 0)
                sb.Append("DROP REMOTE SERVICE BINDING [" + cbRemote.Text + "]");

            tbCommand.Text = sb.ToString();
        }
    }
}